﻿package stfei.HorizList {
	import stfei.HorizList.core.IparseXml;

	/**
	 * ...
	 * @author Stfei设计 汕头创一品牌整合机构
	   项目名称：
	   类应用：实现Xml数据转换接口
	 */
	public class inXMLData implements IparseXml {


		private var xmlArray:Array
		private var xmlItem:XMLList
		private var _totalNum:int

		/* INTERFACE stfei.HorizList.core.IparseXml */

		public function get totalNum():int {
			return _totalNum
		}

		/* INTERFACE stfei.HorizList.core.IparseXml */
		public function ParsingXML(inXML:XML):Array {
			_totalNum=inXML.@Total
			xmlArray = []
			xmlItem = inXML.item			
			this.Item()
			return xmlArray
		}

		private function Item():void {
			var xmlLength:int = xmlItem.length()
			for (var i:int = 0; i < xmlLength; i++){
				var item:Array = new Array()
				item.push(xmlItem[i].@photo)
				item.push(xmlItem[i].@URL)
				item.push(subItem(i))
				xmlArray.push(item)
			}
		}

		private function subItem(val:int):Array {
			var subArray:Array = new Array()
			var subLeng:int = xmlItem[val].detail.length()
			for (var i:int = 0; i < subLeng; i++){
				var item:Array = new Array()
				item.push(xmlItem[val].detail[i].@label)
				item.push(xmlItem[val].detail[i].@body)
				subArray.push(item)
			}

			return subArray
		}


	}

}